home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / Softshoe / Lisa's Mac Parts / Views / View Options / SuggestsPaneSize.cp < prev    next >
Text File  |  2000-06-23  |  2KB  |  98 lines

  1. // SuggestsPaneSize.cp
  2.  
  3. #ifndef SuggestsPaneSize_h
  4. #include "SuggestsPaneSize.h"
  5. #endif
  6.  
  7. int32 SuggestsPaneSize::MinimumWidth() const
  8.   {
  9.     return 0;
  10.   }
  11.  
  12. int32 SuggestsPaneSize::MinimumHeight() const
  13.   {
  14.     return 0;
  15.   }
  16.  
  17. int32 SuggestsPaneSize::MaximumWidth() const
  18.   {
  19.     return maxint32;
  20.   }
  21.  
  22. int32 SuggestsPaneSize::MaximumHeight() const
  23.   {
  24.     return maxint32;
  25.   }
  26.  
  27. int32 SuggestsPaneSize::ReasonableWidth() const
  28.   {
  29.     return MinimumWidth();
  30.   }
  31.  
  32. int32 SuggestsPaneSize::ReasonableHeight() const
  33.   {
  34.     return MinimumHeight();
  35.   }
  36.  
  37. int32 SuggestsPaneSize::BestWidth( Range32 bound ) const
  38.   {
  39.     return bound.WeaklyRestrict( MaximumWidth() );
  40.   }
  41.  
  42. int32 SuggestsPaneSize::BestHeight( Range32 bound ) const
  43.   {
  44.     return bound.WeaklyRestrict( MaximumHeight() );
  45.   }
  46.  
  47. int32 SuggestsPaneSize::BestRevealedWidth( Range32 bound ) const
  48.   {
  49.     return bound.WeaklyRestrict( BestWidth( bound ) );
  50.   }
  51.  
  52. int32 SuggestsPaneSize::BestRevealedHeight( Range32 bound ) const
  53.   {
  54.     return bound.WeaklyRestrict( BestHeight( bound ) );
  55.   }
  56.  
  57. int32 SuggestsPaneSize::BestRevealedLeft( Range32 bound ) const
  58.   {
  59.     return bound.Center();
  60.   }
  61.  
  62. int32 SuggestsPaneSize::BestRevealedTop( Range32 bound ) const
  63.   {
  64.     return bound.Center();
  65.   }
  66.  
  67. const SuggestsPaneSize& SuggestsPaneSize::Zero()
  68.   {
  69.     class ZeroSizer: public SuggestsPaneSize
  70.       {
  71.         public:
  72.             virtual int32 MaximumWidth() const        { return 0; }
  73.             virtual int32 MaximumHeight() const        { return 0; }
  74.       };
  75.     
  76.     static const ZeroSizer zero;
  77.     return zero;
  78.   }
  79.  
  80. const SuggestsPaneSize& SuggestsPaneSize::LargestPossible()
  81.   {
  82.     static const SuggestsPaneSize largestPossible;
  83.     return largestPossible;
  84.   }
  85.  
  86. const SuggestsPaneSize& SuggestsPaneSize::SmallestPossible()
  87.   {
  88.     class SmallestPossibleSizer: public SuggestsPaneSize
  89.       {
  90.         public:
  91.             virtual int32 BestHeight( Range32 bound ) const        { return bound.Start(); }
  92.             virtual int32 BestWidth( Range32 bound ) const        { return bound.Start(); }
  93.       };
  94.     
  95.     static const SmallestPossibleSizer smallestPossible;
  96.     return smallestPossible;
  97.   }
  98.